package com.adteam.xmap.manager.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.adteam.xmap.entity.Transaction;
import com.adteam.xmap.manager.TransactionManager;

public class TransactionManagerImpl extends HibernateDaoSupport implements TransactionManager {

	public void addTransaction(Transaction transaction) {

		getHibernateTemplate().save(transaction);
	}

	public void delTransaction(int id) {

		getHibernateTemplate().delete(findTransactionById(id));
	}

	public List findAllTransactions() {

		return getHibernateTemplate().find("select t from Transaction t");
	}

	public Transaction findTransactionById(int id) {

		return (Transaction)getHibernateTemplate().load(Transaction.class, id);
	}

	public void updateTransaction(Transaction transaction) {

		getHibernateTemplate().update(transaction);
	}

}
